package AnonymityTest;
/*
匿名内部类的使用
 */
public class AnonymityTest2 {
    public static void main(String[] args){
        Sum s = new Sum();
        s.sum(new MyMath(){
            public int sum(int x,int y){
                return x+y;
            }
        },100,12);
    }
}
interface MyMath{
    int sum(int x,int y);
}
class Sum{
    public void sum(MyMath m,int x,int y){
        int re = m.sum(x,y);
        System.out.println(x+"+"+y+"="+re);
    }
}
